pp108 : changeIcon Method

changeIcon Method


This method changes the icon of the tree item (node or a leaf).

Syntax

treeID.root.changeIcon([vurl])

When called from a node other than root, the syntax is as follows:
treeNode.changeIcon([vurl])

Parameters

Parameter

Description

vurl

Required. Variant that denotes the URLof the icon(s) for a tree item. If only one icon needs to be changed, the URL of the icon can be passed as an input, else an array containing URLs can be passed.


Return Value


No return value.

Remarks


This function can be called at runtime to change the icon of the URL. However, to change the icon of a static item in the tree, one can set the property icon to a valid URL.

The function can also be used to change more than one icon for a tree item at runtime. Such cases are possible only when the number of icons is more than one, or by specifying the icons using the icons property of the TreeItem.

Example


The following example shows how the above method is used.

//Function called on onselect property of a tree item
function onSelectHandler(selectedNode)
{
    selectedNode.changeIcon('/cordys/wcp/images/book.gif');
    //Create multiple icons array
    var icons = new Array("/cordys/wcp/images/book.gif", "/cordys/wcp/images/bookopen.gif");
    //Pass multiple icons as input
    selectedNode.changeIcon(icons);
}

See Also


tree, icons